﻿using System;
using System.Windows.Forms;
using Assist;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace HYFamilyLibManager.FamilyLibModule
{
	[Regeneration(RegenerationOption.Manual)]
	[Transaction(TransactionMode.Manual)]
	public class TEST : YJKCommandManual
	{
		protected override Result YJKExcute(ExternalCommandData cmdData, ref string message, ElementSet elements)
		{
			try
			{
				Guid schemaGuid = new Guid("356cda5a-e6c5-4c2f-a9ef-b1223336b8c8");
				Element element = this.m_doc.GetElement(this.m_uiDoc.Selection.PickObject(Autodesk.Revit.UI.Selection.ObjectType.Element));
				MyClass obj = new MyClass("123", 2);
				ExtensibleStorageManager.WriteToElement(element, schemaGuid, obj);
				ExtensibleStorageManager.ReadFromElement<MyClass>(element, schemaGuid);
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
			return base.YJKExcute(cmdData, ref message, elements);
		}
	}
}
